package com.demo.springcloud.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

/**
 * @author chenyuan
 * @date 2020/12/19 10:07
 */
@RestController
@Slf4j
public class OrderNacosController {
	@Value("${service-url.nacos-user-service}")
	private String SERVER_URL;

	@Autowired
	private RestTemplate restTemplate;

	@GetMapping(value = "/consumer/payment/nacos/{id}")
	public String getPayment(@PathVariable("id") Integer id) {
		return restTemplate.getForObject(SERVER_URL + "/payment/nacos/" + id, String.class);
	}
}
